/*
 * Canal.java
 *
 * Created on 2 de octubre de 2008, 06:35 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package com.nextel.project.cobranza.bean;
import pe.com.nextel.rms.DataInputStreamX;
import pe.com.nextel.rms.DataOutputStreamX;
import pe.com.nextel.rms.PersistenteX;
import java.io.IOException;
import org.kxml2.io.KXmlParser;
import org.kxml2.io.KXmlSerializer;
import pe.com.nextel.util.Fecha;
import pe.com.nextel.util.List;
import pe.com.nextel.util.StringUtils;

/**
 *
 * @author eespinoza
 */
public class PagoBean  extends PersistenteX {


    private int recordIDCobranza;
    private short posicionIDCobranza;
    private String codigoCobranza;
    private String codigoVendedor;
    private String codigoCliente;
    private String fechaRegistro;
    private String montoPago;
    private String tipoPago;
    private String codigoBanco;
    private String voucher;
    private String compania;
    private String fPagoLabel;
    public int latitud;
    public int longitud;
    
    private long fechMobil;

    
    
    public void persistir(DataOutputStreamX dataOutput, List list) throws IOException {
        
        persistirItem(dataOutput);
    }
    
    public void persistirItem(DataOutputStreamX dataOutput) throws IOException {
        
        dataOutput.writeInt(recordIDCobranza);
        dataOutput.writeShort(posicionIDCobranza);
        
        dataOutput.writeString(StringUtils.stringNullToBlank(getCodigoVendedor()));
        dataOutput.writeString(StringUtils.stringNullToBlank(getCodigoCliente()));
        dataOutput.writeString(StringUtils.stringNullToBlank(getCodigoCobranza()));
        dataOutput.writeString(getFechaRegistro( ));
        dataOutput.writeString(StringUtils.stringNullToBlank(getMontoPago()));
        
        dataOutput.writeString(StringUtils.stringNullToBlank(getTipoPago()));
        dataOutput.writeString(StringUtils.stringNullToBlank(getCodigoBanco()));
        dataOutput.writeString(StringUtils.stringNullToBlank(getVoucher()));
        dataOutput.writeString(StringUtils.stringNullToBlank(compania));
        dataOutput.writeInt(latitud);
        dataOutput.writeInt(longitud);
        dataOutput.writeLong(getFechMobil());

 
        
    }
    
    public List recuperar(DataInputStreamX dataInput) throws IOException {
        
        recuperarItem(dataInput);
        return null;
    }
    
    
    public void recuperarItem(DataInputStreamX dataInput) throws IOException {
        
        setRecordIDCobranza(dataInput.readInt());
        setPosicionIDCobranza(dataInput.readShort());
        
        setCodigoVendedor(dataInput.readString());
        setCodigoCliente(dataInput.readString());
        setCodigoCobranza(dataInput.readString());
        setFechaRegistro(dataInput.readString());
        setMontoPago(dataInput.readString());
        setTipoPago(dataInput.readString());
        
        setCodigoBanco(dataInput.readString());
        setVoucher(dataInput.readString());
        compania = dataInput.readString();
        latitud = dataInput.readInt();
        longitud = dataInput.readInt();
        setFechMobil(dataInput.readLong());
 
        
    }
    
    public void clear(){
        
    }
    
    public void writeXMLObject(KXmlSerializer writer) throws IOException {
        
        String[] FechaMobil = Fecha.convertTimeSSLongToString(getFechMobil());
        
        String codeBank = "";
        
        writer.startTag(null, "p");

        writer.attribute(null, "v", StringUtils.stringNullToBlank(getCodigoVendedor( )));

        writer.attribute(null, "c", StringUtils.stringNullToBlank(getCodigoCliente( )));
        
        writer.attribute(null, "co", StringUtils.stringNullToBlank(getCodigoCobranza()));
                  
        writer.attribute(null, "mp", StringUtils.stringNullToBlank(getMontoPago( )));

        writer.attribute(null, "tp", StringUtils.stringNullToBlank(getTipoPago()));
        

        writer.attribute(null, "b", StringUtils.stringNullToBlank(getCodigoBanco( )));

        writer.attribute(null, "vo", StringUtils.stringNullToBlank(getVoucher()));

        writer.attribute(null, "com", StringUtils.stringNullToBlank(compania));

        writer.attribute(null,"la" , String.valueOf(latitud));

        writer.attribute(null,"lo", String.valueOf(longitud));

        writer.attribute(null,"fm",FechaMobil[0] + ' '+ FechaMobil[1]);
       
        writer.endTag(null, "p");
        
    }
    
    public void readXMLObject(KXmlParser parser) throws IOException {
        
        
    }
    
    public short getPosicionIDCobranza() {
        return posicionIDCobranza;
    }
    
    public void setPosicionIDCobranza(short posicionIDCobranza) {
        this.posicionIDCobranza = posicionIDCobranza;
    }
    
    public int getRecordIDCobranza() {
        return recordIDCobranza;
    }
    
    public void setRecordIDCobranza(int recordIDCobranza) {
        this.recordIDCobranza = recordIDCobranza;
    }

    
    public String getCodigoCliente() {
        return codigoCliente;
    }
    
    public void setCodigoCliente(String codigoCliente) {
        this.codigoCliente = codigoCliente;
    }
    
    public String getCodigoVendedor() {
        return codigoVendedor;
    }
    
    public void setCodigoVendedor(String codigoVendedor) {
        this.codigoVendedor = codigoVendedor;
    }
    
    public String getFechaRegistro() {
        return fechaRegistro;
    }
    
    public void setFechaRegistro(String fechaRegistro) {
        this.fechaRegistro = fechaRegistro;
    }
    
    public String getMontoPago() {
        return montoPago;
    }
    
    public void setMontoPago(String montoPago) {
        this.montoPago = montoPago;
    }
    
    public String getCodigoCobranza() {
        return codigoCobranza;
    }
    
    public void setCodigoCobranza(String codigoCobranza) {
        this.codigoCobranza = codigoCobranza;
    }
    
    public String getCodigoBanco() {
        return (this.codigoBanco);
        
        
    }
    
    public void setCodigoBanco(String codigoBanco) {
        this.codigoBanco = codigoBanco;
    }
    
    public String getTipoPago() {
        return tipoPago;
    }
    
    public void setTipoPago(String tipoPago) {
        this.tipoPago = tipoPago;
    }
    
    public String getVoucher() {
        return voucher;
    }
    
    public void setVoucher(String voucher) {
        this.voucher = voucher;
    }
    
 
    
    public String getCompania() {
        return compania;
    }
    
    public void setCompania(String empresa) {
        this.compania = empresa;
    }

    public String getFPagoLabel() {
        return fPagoLabel;
    }

    public void setFPagoLabel(String fPagoLabel) {
        this.fPagoLabel = fPagoLabel;
    }
   
    
    public long getFechMobil(){
        return fechMobil;
    }
    
    public void setFechMobil(long fechMobil){
        this.fechMobil =  fechMobil;
    }

}
